
import css from './test.module.css'
import propTypes from 'prop-types';


import React,{Component} from 'react';

import store from 'Store';
import actionCreators from 'Store/base/actionCreators.js';


function test (){
  return (
    <div className={css.testbox}>
      <p>222</p>
      <p>222</p>
      <p className={css['testbox--p']}>222</p>
      <p>222</p>
      <p>222</p>
      <Testtwo age={52}/>
    </div>
  )
}

class Testtwo extends Component {
  constructor(){
    super()
    this.state = {
      name: 'join',
      age: 26
    }
  }

  protest=(e)=>{
    console.log("aaa",this)
    console.log("bbb",e)
    this.setState({
      name:'55',
      age: 58
    })
  }

  render (){
    return (
      <div className={css.testbox}>
        <p onClick={this.protest}>222</p>
        <p>222</p>
        <p className={css['testbox--p']}>222</p>
        <p>222</p>
        <p >{this.state.age}</p>
      </div>
    )
  }

  componentDidMount(){
      React.http({
        url:"/app/jk",
        // type: 'get'
      })
      .then((res)=>{
        console.log("res",res)
      })

      console.log("store", store.getState())



  }
}

// Testtwo是要被检查的组件名字，propTypes
// name:propTypes.number, 表示通过name属性传递的数据要使用Number类型
Testtwo.propTypes={
  name:propTypes.number,
  age:propTypes.number,
}

export default test;